<?php
/**
 * 作用：公用模块，用于放置零碎，不能组成模块的功能函数及常量
 * 作者: shijy@soe-soe.com
 * 日期: 2016/5/11 16:09
 * 公司: 浙江宣逸网络科技有限公司<www.soe-soe.com>
 */


namespace Common\Model;


class RoomModel extends BaseModel{
    //床型
    public static function getBedKv(){
        return M('cfg_item',null,DB_MAIN_CFG)->where('type=3')->getField('id,name');
    }



    //配套
    const ATTACHMENT_LAKE       = 1;//湖景
    const ATTACHMENT_WIFI       = 2;//WIFI
    const ATTACHMENT_TOILET     = 3;//卫生间
    const ATTACHMENT_BALCONY    = 4;//阳台

    const ROOM_ONLINE =1;//上架中
    const ROOM_OFFLINE=2;//下架中

    /**
     * 客房当前状态
     */
    const ROOM_STATUS_IDLE      = 0;//闲置
    const ROOM_STATUS_BUSY      = 1;//客满
    const ROOM_STATUS_MAINTAIN  = 2;//维护
    const ROOM_STATUS_WAIT_PAY  = 3;//待付费
    const ROOM_STATUS_LOCK      = 4;//锁定


    public static function getStatusKv(){
        return array(
            self::ROOM_STATUS_IDLE      =>'闲置',
            self::ROOM_STATUS_BUSY      =>'客满',
            self::ROOM_STATUS_MAINTAIN  =>'维护',
            self::ROOM_STATUS_WAIT_PAY  =>'待付费',
            self::ROOM_STATUS_LOCK      =>'锁定'
        );
    }

    private static $roomInstance=null;
    public static function getRoomInstance(){
        if(!self::$roomInstance){
            self::$roomInstance=M('r_room',null,DB_MAIN_CFG);
        }
        return self::$roomInstance;
    }

    private static $statusInstance=null;
    public static function getStatusInstance(){
        if(!self::$statusInstance){
            self::$statusInstance=M('r_status',null,DB_MAIN_CFG);
        }
        return self::$statusInstance;
    }

    
    public static function getRoomKv(){
        return self::getRoomInstance()->getField('rid,roomName',true);
    }
    
    
    
    
    
    
}